You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
596 B
24 lines
596 B
import { requireUser } from "#server/utils/context";
|
|
import { updateModel } from "#server/service/llm";
|
|
|
|
export default defineWrappedResponseHandler(async (event) => {
|
|
const user = await requireUser(event);
|
|
|
|
const id = Number(getRouterParam(event, "id"));
|
|
if (!id) {
|
|
return R.throwError(400, "无效的模型ID", null);
|
|
}
|
|
|
|
const body = await readBody(event);
|
|
const { name, modelId, type, enabled, description, maxTokens } = body;
|
|
|
|
await updateModel(id, user.id, {
|
|
name,
|
|
modelId,
|
|
type,
|
|
enabled,
|
|
description,
|
|
maxTokens,
|
|
});
|
|
return R.success(null);
|
|
});
|
|
|